﻿using FBProject.BusinessLogic.MSProjectProxies;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FBProjectTest
{
    
    
    /// <summary>
    ///This is a test class for MSProjectProxyTest and is intended
    ///to contain all MSProjectProxyTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MSProjectProxyTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for FBUrl
        ///</summary>
        [TestMethod()]
        public void FBUrlTest()
        {
            var application = new MockObjects.MSProject.ApplicationMock();
            var project = new MockObjects.MSProject.ProjectMock(application, null);
            var target = new MSProjectProxy(application);

            string actual = target.FBUrl;
            Assert.AreEqual(string.Empty, actual);

            target.FBUrl = "http://fogbugz";
            actual = target.FBUrl;
            Assert.AreEqual("http://fogbugz", actual);

            target.FBUrl = "http://another.fogbugz";
            actual = target.FBUrl;
            Assert.AreEqual("http://another.fogbugz", actual);
        }

        /// <summary>
        ///A test for FBCaseNumberFormat
        ///</summary>
        [TestMethod()]
        public void FBCaseNumberFormatTest()
        {
            var application = new MockObjects.MSProject.ApplicationMock();
            var project = new MockObjects.MSProject.ProjectMock(application, null);
            var target = new MSProjectProxy(application);

            string actual = target.FBCaseNumberFormat;
            Assert.AreEqual("FB{0}", actual);

            target.FBCaseNumberFormat = "FB#{0}";
            actual = target.FBCaseNumberFormat;
            Assert.AreEqual("FB#{0}", actual);

            target.FBCaseNumberFormat = "{0}";
            actual = target.FBCaseNumberFormat;
            Assert.AreEqual("{0}", actual);
        }

        /// <summary>
        ///A test for FBCaseUrlFormat
        ///</summary>
        [TestMethod()]
        public void FBCaseUrlFormatTest()
        {
            var application = new MockObjects.MSProject.ApplicationMock();
            var project = new MockObjects.MSProject.ProjectMock(application, null);
            var target = new MSProjectProxy(application);

            string actual = target.FBCaseUrlFormat;
            Assert.AreEqual("{0}default.asp?{1}", actual);

            target.FBCaseUrlFormat = "{0}default.asp?{1}#{2}";
            actual = target.FBCaseUrlFormat;
            Assert.AreEqual("{0}default.asp?{1}#{2}", actual);

            target.FBCaseUrlFormat = "{0}default.aspx?{1}";
            actual = target.FBCaseUrlFormat;
            Assert.AreEqual("{0}default.aspx?{1}", actual);
        }
    }
}
